#ifndef TRIANGLE
#define TRIANGLE

#include "WorldObject.h"
#include <list>
#include "GeomNode.h"
#include "PerlinNoise.h"
#include "GeomBuilder.h"
#include "iostream"
#include "math.h"
#include "Vertex.h"
#include "TerrainSegment.h"
#include "Vect3D.h"

class Terrain 
{
	public:
		Terrain(int numVertices);
	//	Terrain();
		~Terrain();
		void setMultiplier(int mult);
		void setNoise(float per, float freq, float oct);
		static float getHeight(float x, float z);
		GeomNode *Terrain::getGrid();
		std::list<WorldObject *> getTerrain(float minX, float maxX, float minY, float maxY);
	private:
		void testTerrain(Vect3D *corners);
		Vect3D *triangleLeftMost(int minX, int maxX, int minZ, int maxZ);
		Vect3D *triangleLeftMid(int minX, int maxX, int minZ, int maxZ);
		Vect3D *triangleRightMid(int minX, int maxX, int minZ, int maxZ);
		Vect3D *triangleRightMost(int minX, int maxX, int minZ, int maxZ);
		Vertex *heightGrid;
		int numVertices;
		bool test;
		int mult;
		PerlinNoise noise;
};
#endif // TRIANGLE